//
//  IOSKnowledgeViewController.m
//  iOSCodeLearning
//
//  Created by Ace on 2017/10/31.
//  Copyright © 2017年 Ace. All rights reserved.
//

#import "IOSKnowledgeViewController.h"
#import "KnowLedgeTableViewCell.h"
// vc
#import "CacheViewController.h"
#import "MultiThreadViewController.h"
#import "AutoLayoutViewController.h"
#import "NSOperatinViewController.h"
#import "RunLoopViewcontroller.h"
#import "MVPViewController.h"
#import "MVPListViewController.h"
#import "TestPageViewController.h"
#import "AppearanceViewController.h"
#import "CustomLayoutViewController.h"
#import "MVVMTableViewController.h"
#import "CCTableViewController.h"
#import "TouchViewController.h"
#import "UIEventViewController.h"
#import "CustomEventViewController.h"
#import "HitTestViewController.h"

@interface IOSKnowledgeViewController ()<UITableViewDelegate,UITableViewDataSource>
@property (weak, nonatomic) IBOutlet UITableView *tableView;

@property(nonatomic,strong) NSMutableArray  *titles;

@end

@implementation IOSKnowledgeViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self p_initTitles];
}

- (void)p_initTitles{
    
    [self.titles addObject:@"缓存机制"];
    [self.titles addObject:@"多线程"];
    [self.titles addObject:@"AutoLayout"];
    [self.titles addObject:@"NSOperation"];
    [self.titles addObject:@"RunLoop"];
    [self.titles addObject:@"MVP"];
    [self.titles addObject:@"MVPList"];
    [self.titles addObject:@"pageNode"];
    [self.titles addObject:@"appearance"];
    [self.titles addObject:@"自定义layout"];
    [self.titles addObject:@"MVVM"];
    [self.titles addObject:@"TableViewManager"];
    [self.titles addObject:@"touch"];
    [self.titles addObject:@"Event"];
    [self.titles addObject:@"customEvent"];
    [self.titles addObject:@"hitTest"];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    
}


- (nonnull UITableViewCell *)tableView:(nonnull UITableView *)tableView cellForRowAtIndexPath:(nonnull NSIndexPath *)indexPath {
    KnowLedgeTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"KnowLedgeTableViewCellID"];
    cell.titleLbael.text = self.titles[indexPath.row];
    
    return cell;

   
}

- (NSInteger)tableView:(nonnull UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    
    return self.titles.count;
}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    
    switch (indexPath.row) {
        case 0:
        {
            CacheViewController *cacheVC = [[CacheViewController alloc]init];
            cacheVC.hidesBottomBarWhenPushed = YES;
            [self.navigationController pushViewController:cacheVC animated:YES];
        }
            break;
        case 1:
        {
            MultiThreadViewController *multiThreadVC = [[MultiThreadViewController alloc]init];
            multiThreadVC.hidesBottomBarWhenPushed = YES;
            [self.navigationController pushViewController:multiThreadVC animated:YES];
        }
            break;
        case 2:
        {
            AutoLayoutViewController *autoLayoutVC = [[AutoLayoutViewController alloc]init];
            autoLayoutVC.hidesBottomBarWhenPushed = YES;
            [self.navigationController pushViewController:autoLayoutVC animated:YES];
        }
            break;
        case 3:
        {
            NSOperatinViewController * operationVC = [[NSOperatinViewController alloc] init];
            operationVC.hidesBottomBarWhenPushed = YES;
            [self.navigationController pushViewController:operationVC animated:YES];
        }
            break;
        case 4:
        {
            RunLoopViewcontroller *runLoopVc = [[RunLoopViewcontroller alloc]init];
            runLoopVc.hidesBottomBarWhenPushed = YES;
            [self.navigationController pushViewController:runLoopVc animated:YES];
        }
            break;
        case 5:
        {
            MVPViewController *mvpVc = [[MVPViewController alloc]init];
            mvpVc.hidesBottomBarWhenPushed = YES;
            [self.navigationController pushViewController:mvpVc animated:YES];
        }
            break;
        case 6:
        {
            MVPListViewController *mvpListVc = [[MVPListViewController alloc]init];
            mvpListVc.hidesBottomBarWhenPushed = YES;
            [self.navigationController pushViewController:mvpListVc animated:YES];
        }
            break;
        case 7:
        {
            TestPageViewController *testPageVC = [[TestPageViewController alloc]init];
            testPageVC.hidesBottomBarWhenPushed = YES;
            [self.navigationController pushViewController:testPageVC animated:YES];
        }
            break;
        case 8:
        {
            AppearanceViewController *appearanceVC = [[AppearanceViewController alloc]init];
            appearanceVC.hidesBottomBarWhenPushed = YES;
            [self.navigationController pushViewController:appearanceVC animated:YES];
        }
            break;
        case 9:
        {
            CustomLayoutViewController *customVC = [[CustomLayoutViewController alloc]init];
            customVC.hidesBottomBarWhenPushed = YES;
            [self.navigationController pushViewController:customVC animated:YES];
        }
            break;
        case 10:
        {
            MVVMTableViewController *vc = [[MVVMTableViewController alloc]init];
            vc.hidesBottomBarWhenPushed = YES;
            [self.navigationController pushViewController:vc animated:YES];
        }
            break;
        case 11:
        {
            CCTableViewController *vc = [[CCTableViewController alloc] init];
            vc.hidesBottomBarWhenPushed = YES;
            [self.navigationController pushViewController:vc animated:YES];
        }
            break;
        case 12:
        {
            TouchViewController *vc = [[TouchViewController alloc] init];
            vc.hidesBottomBarWhenPushed = YES;
            [self.navigationController pushViewController:vc animated:YES];
        }
            break;
        case 13:
        {
            UIEventViewController *vc = [[UIEventViewController alloc]initWithNibName:@"UIEventViewController" bundle:nil];
            vc.hidesBottomBarWhenPushed = YES;
            [self.navigationController pushViewController:vc animated:YES];
        }
            break;
        case 14:
        {
            CustomEventViewController *vc = [[CustomEventViewController alloc]initWithNibName:@"CustomEventViewController" bundle:nil];
            vc.hidesBottomBarWhenPushed =  YES;
            [self.navigationController pushViewController:vc animated:YES];
        }
            break;
        case 15:
        {
            HitTestViewController *vc = [[HitTestViewController alloc]init];
            vc.hidesBottomBarWhenPushed = YES;
            [self.navigationController pushViewController:vc
                                                 animated:YES];
        }
        default:
            break;
    }
}



-(NSMutableArray*)titles{
    
    if (!_titles) {
        _titles = [NSMutableArray array];
    }
    return _titles;
}




@end
